package com.itwn.portal.config;

import org.springframework.cache.interceptor.KeyGenerator;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.lang.reflect.Method;
import java.util.Arrays;

/**
 * @author cx
 * @date 2022/2/8
 * @apiNote
 */
@Configuration
public class MyGenerateKeyConfig {

    @Bean(value = "myGenerateKey")
    public KeyGenerator keyGenerator(){
        return  new KeyGenerator(){

            @Override
            public Object generate(Object o, Method method, Object... objects) {
                return method.getName()+ Arrays.asList(objects).toString();
            }
        };
    }
}
